package com.wm.web.controller.system;


import com.wm.common.core.controller.BaseController;
import com.wm.common.core.domain.AjaxResult;
import com.wm.common.core.page.TableDataInfo;
import com.wm.system.domain.OldForNewService;
import com.wm.system.service.IOldForNewServiceService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author hyq
 * @since 2023-10-10 22:48:15
 */
@RestController
@RequestMapping("/system/oldForNewService")
public class OldForNewServiceController extends BaseController {

    @Autowired
    private IOldForNewServiceService service;

    @ApiOperation("以旧换新分页查询")
    @GetMapping("list")
    public TableDataInfo list(OldForNewService oldForNewService){
        startPage();
        List<OldForNewService> oldList = service.selectList(oldForNewService);
        return getDataTable(oldList);
    }

    @ApiOperation("以旧换新新增和查询")
    @PostMapping("addOrUpdate")
    public AjaxResult addOrUpdate(@RequestBody OldForNewService oldForNewService){
        service.addOrUpdate(oldForNewService);
        return AjaxResult.success();
    }
}
